package com.cj.bus.controller;


import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cj.bus.service.BusResourceService;

import lombok.extern.slf4j.Slf4j;


@Controller
@Slf4j
public class IndexController {

	@Resource
	private BusResourceService busResourceService;
	
	@RequestMapping(value="/index")
	public String index() {
		return "index";
	}
	
	@RequestMapping(value="/resourceList")
	public String resourceList() {
		return "resourceList";
	}
	
	@RequestMapping(value="/resource/{resourceId}")
	public ModelAndView resource(@PathVariable("resourceId") Long resourceId) {
		try {
			ModelAndView mv = new ModelAndView("resource");
			mv.addObject("resourceId",  resourceId);
			return mv;
		}catch (Exception e) {
			log.error("获取资源异常!",e);
			return new ModelAndView("error");
		}
	}
	
	@RequestMapping(value="/head")
	public String head() {
		return "head";
	}
	
	@RequestMapping(value="/foot")
	public String foot() {
		return "foot";
	}


}
